const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
  devServer:{
    //port:9530,
    proxy: {
      '/api': {
          target: 'http://localhost:9000',
          changeOrigin: true,
          ws: true,
          pathRewrite: {
              '^/api': ''
          }
      }
    }
  },
  configureWebpack: config => {
    const cwp = new CopyWebpackPlugin({
      patterns: [
        {
          from: './src/js',
          to: 'XbsjEarthUI',
          toType: 'dir'
        },
        {
          from: './node_modules/earthsdk/dist/XbsjCesium',
          to: 'XbsjCesium',
          toType: 'dir'
        },
        {
          from: './node_modules/earthsdk/dist/XbsjEarth',
          to: 'XbsjEarth',
          toType: 'dir'
        },
        {
          from: './node_modules/earthsdk-plotting-symbol/dist/XbsjEarth-Plugins/plottingSymbol',
          to: 'XbsjEarth-Plugins/plottingSymbol',
          toType: 'dir'
        },
        {
          from: './node_modules/earthsdk-custom-primitive/dist/XbsjEarth-Plugins/customPrimitive',
          to: 'XbsjEarth-Plugins/customPrimitive',
          toType: 'dir'
        },
        {
          from: 'Static/XbsjEarth-Private-Plugins',
          to: 'XbsjEarth-Plugins',
          toType: 'dir'
        },
        {
          from: 'Static/assets',
          to: 'XbsjEarthUI/assets',
          toType: 'dir'
        },
      ]
    })
    config.plugins.push(cwp)
  },
  runtimeCompiler: true,
  lintOnSave: false
}